<template>
  <el-container class="home-container">
    <!--头部区域-->
    <!-- <el-header style="height:99.994px !important">
      <div>
        <img src="../assets/logo.png" alt style="margin-left:20.006px; width:39.994px;height:37.997px" />
        <span>峡江水利枢纽工程信息平台仓库管理模块</span>
      </div>
      <div>
        <i class="el-icon-bell"></i>
        <el-dropdown>
          <span class="el-dropdown-link" style="font-size:15.994px">
            {{ userinfo.userName }}
            <i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item>
              <el-link style="color:red" @click="logout">退出登录</el-link>
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header> -->
    <el-container>
      <!--侧边栏-->
      <!-- <el-aside :width="isCollapse ?'60px':'240px'">
        <el-menu
          background-color="#3482f3"
          text-color="#ffffff"
          active-text-color="#ffffff"
          :unique-opened="true"
          :collapse="isCollapse"
          :collapse-transition="false"
          :router="true"
        >
          <template v-for="menu in newRoutes">
            <template v-if="menu.rank == 0 || menu.rank == userinfo.userRank">
              <el-submenu v-if="menu.children.length" :key="menu.index" :index="menu.index">
                <template slot="title">
                  <i
                    :class="menu.meta.icon"
                    style="color: #fff;margin-right: 6.01px;"
                    v-if="menu.meta"
                  ></i>
                  <span>{{menu.label}}</span>
                </template>
                <el-menu-item
                  v-for="child in menu.children"
                  class="alink"
                  :key="child.index"
                  :index="child.index"
                >
                  <span slot="title">{{child.label}}</span>
                </el-menu-item>
              </el-submenu>
              <el-menu-item v-else class="alink" :key="menu.index" :index="menu.index">
                <i :class="menu.meta.icon" style="color: #fff;margin-right: 6.01px;" v-if="menu.meta"></i>
                <span slot="title">{{menu.label}}</span>
              </el-menu-item>
            </template>
          </template>
          <div class="info">
            <el-divider></el-divider>
            <p
              style="font-size: 12px;color: #ffffff;text-align: center;font-family: 宋体;display: block;word-spacing: -3.994px;line-height: 4.992px;"
            >技术支持：江西鄱水信息科技有限公司</p>
            <p
              style="font-size:12px;color:#ffffff;text-align:center; font-family:宋体; display:block; word-spacing:-3.994px;line-height: 4.992px;"
            >服务电话：18702545455</p>
          </div>
        </el-menu>
      </el-aside> -->
      <!--右侧内容主体-->
      <el-main style="margin-left: -0.998px;">
        <!--路由占位符-->
        <router-view :show="1"></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
      isCollapse: false,
      //左侧菜单数据
      menulist: [],
      topActive: "welcome",
      sideActive: "welcome/news",
      // newRoutes: [
      //   {
      //     label: "防汛仓库",
      //     index: "/home/storehouse1",
      //     meta: { icon: "icon iconfont icon-jiangchengguanli" },
      //     children: [
      //       { index: "/home/storehouse1/acceptance", label: "入库管理" },
      //       { index: "/home/storehouse1/delivery", label: "出库管理" },
      //       { index: "/home/storehouse1/scrap", label: "报废管理" },
      //       { index: "/home/storehouse1/inventory", label: "盘点管理" },
      //       { index: "/home/storehouse1/stock", label: "库存管理" },
      //       { index: "/home/storehouse1/statistics", label: "库存统计" },
      //     ],
      //     rank: 0,
      //   },
      //   {
      //     label: "备品备件仓库",
      //     index: "/home/storehouse2",
      //     meta: { icon: "icon iconfont icon-tianbao" },
      //     children: [
      //       { index: "/home/storehouse2/acceptance", label: "入库管理" },
      //       { index: "/home/storehouse2/delivery", label: "出库管理" },
      //       { index: "/home/storehouse2/scrap", label: "报废管理" },
      //       { index: "/home/storehouse2/inventory", label: "盘点管理" },
      //       { index: "/home/storehouse2/stock", label: "库存管理" },
      //       { index: "/home/storehouse2/statistics", label: "库存统计" },
      //     ],
      //     rank: 0,
      //   },
      //   {
      //     label: "权限管理",
      //     index: "/home/jurisdiction",
      //     meta: { icon: "el-icon-view" },
      //     children: [],
      //     rank: 0,
      //   },
      // ],
    };
  },
  computed: {
    ...mapState("auth", ["userinfo"]),
    sideMenu() {
      return this.routes[this.topActive];
    },
  },
  methods: {
    ...mapActions("auth", ["clearState"]),
    ...mapActions("tagsView", ["delAllViews"]),
    handleTopClick(name) {
      this.topActive = name;
      this.$router.push(`/home/${name}`);
    },
    logout() {
      this.clearState();
      this.delAllViews();
      this.$router.push("/login");
    },
    toggleCollapse() {
      this.isCollapse = !this.isCollapse;
    },

  },
  watch: {
    $route(val) {
      console.log("watch route ... ", val);
    },
  },
};
</script>
<style lang="less" scoped>
.el-dropdown-link {
  cursor: pointer;
  color: #ffffff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.home-container {
  height: 100%;
}
.el-header {
  height: 99.994px;
  background-color: #105fd1;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  align-items: center;
  font-family: "微软雅黑";
  font-weight: bold;
  color: #ffffff;
  font-size: 30.01px;
  > div {
    display: flex;
    align-items: center;
    margin-left: 10.003px;
    span {
      margin-left: 14.995px;
    }
  }
}
.el-menu {
  border-right: 1px solid #e6e6e6;
  height: 56px;
  line-height: 56.006px;
  margin-top: 30.01px;
  margin-left: 30.01px;
}
.el-menu .el-menu-item.is-active {
  background: #ffffff !important;
  color: #70a7f7 !important;
}
.el-menu .el-menu-item.is-active i {
  color: #70a7f7 !important;
}
.el-menut .el-submenu__title.is-active {
  background: #6db6ff !important;
}
.el-menut .el-submenu__title.is-active i {
  color: #70a7f7 !important;
}
.el-link.el-link--default {
  color: #ffffff;
}
.el-link.el-link--default:hover {
  color: #3482f3;
}
.el-aside {
  background-color: #3482f3;
  border-right: 0.998px solid #cccccc;
}
.el-main {
  background-color: #ffffff;
}
.el-menu {
  background-color: #ffffff;
}
.active {
  color: #fff !important;
  text-decoration: underline;
}
.el-divider--horizontal {
  margin: 8.006px 0;
  background: 0 0;
  border-top: 0.998px dashed #e8eaec;
}
.info {
  position: fixed;
  overflow: hidden;
  bottom: 0;
  margin-left: -14.995px;
}
</style>
